/**
 * Selling Partner API for Replenishment
 * The Selling Partner API for Replenishment (Replenishment API) provides programmatic access to replenishment program metrics and offers. These programs provide recurring delivery of any replenishable item at a frequency chosen by the customer.  The Replenishment API is available worldwide wherever Amazon Subscribe & Save is available or is supported. The API is available to vendors and FBA selling partners.
 *
 * The version of the OpenAPI document: 2022-11-07
 *
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 *
 */

import { ApiClient } from '../ApiClient.js'
import { AggregationFrequency } from './AggregationFrequency.js'
import { Metric } from './Metric.js'
import { ProgramType } from './ProgramType.js'
import { TimeInterval } from './TimeInterval.js'
import { TimePeriodType } from './TimePeriodType.js'

/**
 * The GetSellingPartnerMetricsRequest model module.
 * @module replenishment_v2022_11_07/model/GetSellingPartnerMetricsRequest
 * @version 2022-11-07
 */
export class GetSellingPartnerMetricsRequest {
  /**
   * Constructs a new <code>GetSellingPartnerMetricsRequest</code>.
   * The request body for the &#x60;getSellingPartnerMetrics&#x60; operation.
   * @alias module:replenishment_v2022_11_07/model/GetSellingPartnerMetricsRequest
   * @class
   * @param timeInterval {TimeInterval}
   * @param timePeriodType {TimePeriodType}
   * @param marketplaceId {String} The marketplace identifier. The supported marketplaces for both sellers and vendors are US, CA, ES, UK, FR, IT, IN, DE and JP. The supported marketplaces for vendors only are BR, AU, MX, AE and NL. Refer to [Marketplace IDs](https://developer-docs.amazon.com/sp-api/docs/marketplace-ids) to find the identifier for the marketplace.
   * @param programTypes {[ProgramType]} A list of replenishment program types.
   */
  constructor (timeInterval, timePeriodType, marketplaceId, programTypes) {
    this.timeInterval = timeInterval
    this.timePeriodType = timePeriodType
    this.marketplaceId = marketplaceId
    this.programTypes = programTypes
  }

  /**
   * Constructs a <code>GetSellingPartnerMetricsRequest</code> from a plain JavaScript object, optionally creating a new instance.
   * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
   * @param {Object} data The plain JavaScript object bearing properties of interest.
   * @param {GetSellingPartnerMetricsRequest} obj Optional instance to populate.
   * @return {GetSellingPartnerMetricsRequest} The populated <code>GetSellingPartnerMetricsRequest</code> instance.
   */
  static constructFromObject (data, obj) {
    if (data) {
      switch (typeof data) {
        case 'string':
          obj = String(data)
          break
        case 'number':
          obj = Number(data)
          break
        case 'boolean':
          obj = Boolean(data)
          break
      }
      obj = obj || new GetSellingPartnerMetricsRequest()
      if (data.hasOwnProperty('aggregationFrequency')) { obj.aggregationFrequency = AggregationFrequency.constructFromObject(data.aggregationFrequency) }
      if (data.hasOwnProperty('timeInterval')) { obj.timeInterval = TimeInterval.constructFromObject(data.timeInterval) }
      if (data.hasOwnProperty('metrics')) { obj.metrics = ApiClient.convertToType(data.metrics, [Metric]) }
      if (data.hasOwnProperty('timePeriodType')) { obj.timePeriodType = TimePeriodType.constructFromObject(data.timePeriodType) }
      if (data.hasOwnProperty('marketplaceId')) { obj.marketplaceId = ApiClient.convertToType(data.marketplaceId, 'String') }
      if (data.hasOwnProperty('programTypes')) { obj.programTypes = ApiClient.convertToType(data.programTypes, [ProgramType]) }
    }
    return obj
  }
}

/**
 * @member {AggregationFrequency} aggregationFrequency
 * @type {AggregationFrequency}
 */
GetSellingPartnerMetricsRequest.prototype.aggregationFrequency = undefined

/**
 * @member {TimeInterval} timeInterval
 * @type {TimeInterval}
 */
GetSellingPartnerMetricsRequest.prototype.timeInterval = undefined

/**
 * The list of metrics requested. If no metric value is provided, data for all of the metrics will be returned.
 * @member {[Metric]} metrics
 * @type {[Metric]}
 */
GetSellingPartnerMetricsRequest.prototype.metrics = undefined

/**
 * @member {TimePeriodType} timePeriodType
 * @type {TimePeriodType}
 */
GetSellingPartnerMetricsRequest.prototype.timePeriodType = undefined

/**
 * The marketplace identifier. The supported marketplaces for both sellers and vendors are US, CA, ES, UK, FR, IT, IN, DE and JP. The supported marketplaces for vendors only are BR, AU, MX, AE and NL. Refer to [Marketplace IDs](https://developer-docs.amazon.com/sp-api/docs/marketplace-ids) to find the identifier for the marketplace.
 * @member {String} marketplaceId
 * @type {String}
 */
GetSellingPartnerMetricsRequest.prototype.marketplaceId = undefined

/**
 * A list of replenishment program types.
 * @member {[ProgramType]} programTypes
 * @type {[ProgramType]}
 */
GetSellingPartnerMetricsRequest.prototype.programTypes = undefined
